

package com.scs.application.modules.order.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.scs.application.core.model.DataEntity;
import com.scs.application.core.utils.DateUtils;
import com.scs.application.core.utils.excel.annotation.ExcelAutoColumnSize;
import com.scs.application.core.utils.excel.annotation.ExcelComment;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 采购订单实体对象
 *
 */
@TableName("purchase_order")
@Data
@ExcelAutoColumnSize
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@Accessors(chain = true)
public class ExcelPurchaseOrderDTO extends DataEntity implements IExcelDataModel, IExcelModel, Serializable {

    /**
     * 订单ID
     */
    private String id;

    /**
     * 院方ID
     */
    private String hospitalId;

    /**
     * 院方名称
     */
    private String hospitalName;

    /**
     * 订单编号
     */
    @ExcelComment(notNull = true, example = "PO20200303002811")
    @Excel(name = "订单编号")
    @NotBlank(message = "订单编号不能为空")
    private String code;

    /**
     * 供应商ID
     */
    private String supplierId;

    /**
     * 供应商名称
     */
    @ExcelComment(notNull = true, example = "济南天龙正德医疗器械有限公司")
    @Excel(name = "供应商名称", needMerge = true)
    @NotBlank(message = "供应商名称不能为空")
    @Length(min = 1, max = 100, message = "供应商名称长度必须介于 1 和 100 之间")
    private String supplierName;

    /**
     * 送达地点ID
     */
    private String warehouseId;

    /**
     * 送达地点名称
     */
    @ExcelComment(notNull = true, example = "器械库房")
    @Excel(name = "送达地点名称", needMerge = true)
    @NotBlank(message = "送达地点名称不能为空")
    @Length(min = 1, max = 50, message = "送达地点名称长度必须介于 1 和 50 之间")
    private String warehouseName;

    /**
     * 是否寄售
     */
    @ExcelComment(notNull = true, dict = "common_yes_no", example = "1")
    @Excel(name = "是否寄售", dict = "common_yes_no", needMerge = true)
    @NotBlank(message = "是否寄售不能为空")
    private String isConsignment;

    /**
     * 是否一物一码
     */
    @ExcelComment(notNull = true, dict = "common_yes_no", example = "1")
    @Excel(name = "是否一物一码", dict = "common_yes_no", needMerge = true)
    @NotBlank(message = "是否一物一码不能为空")
    private String isOneThingOneYard;

    /**
     * 要求送达日期
     */
    @ExcelComment(notNull = true, example = "1")
    @Excel(name = "要求送达日期", databaseFormat = DateUtils.YYYYMMDDHHMMSS_PATTER, format = "yyyy-MM-dd", needMerge = true)
    @NotNull(message = "要求送达日期不能为空")
    private java.util.Date gmtRequireLatestDelivery;

    /**
     * 订单金额(元)
     */
    @ExcelComment(notNull = true, example = "45520")
    @Excel(name = "订单金额(元)", needMerge = true)
    @NotNull(message = "订单金额不能为空")
    private Double totalAmount;

    /**
     * 采购员
     */
    private String buyerName;

    /**
     * 审核人
     */
    private String auditorName;

    /**
     * 提交时间
     */
    private java.util.Date gmtSubmitted;

    /**
     * 审核时间
     */
    private java.util.Date gmtAudited;

    /**
     * 供应商确认状态
     */
    private Integer supplierConfirmStatus;

    /**
     * 供应商确认用户
     */
    private String supplierConfirmer;

    /**
     * 供应商确认时间
     */
    private java.util.Date gmtSupplierConfirmed;

    /** 发货状态 */

    /**
     * 首次发货时间
     */
    private java.util.Date gmtFirstDelivery;

    /**
     * 订单状态
     */
    private Integer status;

    /**
     * 是否关闭
     */
    private Integer isClosed;

    /**
     * 关闭时间
     */
    private java.util.Date gmtClosed;

    /**
     * 数据来源
     */
    private Integer source;

    /**
     * 来源标识
     */
    private String sourceKey;

    /*@ExcelCollection(name = "订单明细")
    private List<PurchaseOrderItemDTO> items;*/

    /**
     * 订单ID
     */
    private String poId;

    /**
     * 商品规格ID
     */
    private String materialSpecId;

    /**
     * 商品编码
     */
    @ExcelComment(example = "H004161")
    @Excel(name = "商品编码")
    private String materialCode;

    /**
     * 商品代码
     */
    @ExcelComment(example = "123456789")
    @Excel(name = "商品代码")
    @NotBlank(message = "商品代码不能为空")
    @Length(max = 20, message = "商品代码长度必须介于 0 和 20 之间")
    private String materialErpCode;

    /**
     * 商品名称
     */
    @ExcelComment(example = "ZS2系列植入式给药装置")
    @Excel(name = "商品名称")
    @Length(max = 100, message = "商品名称长度必须介于 0 和 100 之间")
    private String materialName;

    /**
     * 商品通用名
     */
    @ExcelComment(example = "ZS2系列植入式给药装置")
    @Excel(name = "商品通用名")
    @Length(max = 100, message = "商品通用名长度必须介于 0 和 100 之间")
    private String materialTradeName;

    /**
     * 规格
     */
    @ExcelComment(notNull = true, example = "ZS2-II-J-1.8/1.2-750")
    @Excel(name = "规格")
    @NotBlank(message = "规格不能为空")
    @Length(min = 1, max = 100, message = "规格长度必须介于 1 和 100 之间")
    private String materialSpec;

    /**
     * 厂商名称
     */
    @ExcelComment(notNull = true, example = "强生（上海）医疗器材有限公司")
    @Excel(name = "厂商名称")
    @NotBlank(message = "厂商名称不能为空")
    @Length(min = 1, max = 100, message = "厂商名称长度必须介于 1 和 100 之间")
    private String manufacturerName;

    /** 剂型 */
    /*@ExcelComment(notNull = true, example = "1")
    @Excel(name = "剂型")
    @Length(max=50, message="剂型长度必须介于 0 和 50 之间")
    private String form;*/

    /**
     * 价格
     */
    @ExcelComment(notNull = true, example = "45530")
    @Excel(name = "价格")
    @NotNull(message = "价格不能为空")
    private Double price;

    /**
     * 小计(元)
     */
    @ExcelComment(notNull = true, example = "16230")
    @Excel(name = "小计(元)")
    @NotNull(message = "小计(元)不能为空")
    private Double subtotalAmount;

    /**
     * 已发货数量
     */
    private Double deliveredQty;

    /**
     * 已发货金额(元)
     */
    private Double deliveredAmount;

    /**
     * 已发货数量
     */
    private Double storedQty;

    /**
     * 发货状态
     */
    private Integer deliveryStatus;

    /**
     * 数量
     */
    @ExcelComment(notNull = true, example = "200")
    @Excel(name = "数量")
    @NotNull(message = "数量不能为空")
    private Double qty;

    /**
     * 单位
     */
    @ExcelComment(notNull = true, example = "个")
    @Excel(name = "单位")
    @NotBlank(message = "单位不能为空")
    @Length(min = 1, max = 4, message = "单位长度必须介于 1 和 4 之间")
    private String unit;

    /**
     * 订单单位
     */
    @ExcelComment(notNull = true, example = "盒")
    @Excel(name = "订单单位")
    @NotNull(message = "订单单位不能为空")
    private String orderUnit;

    /**
     * 订单单位数量
     */
    @ExcelComment(notNull = true, example = "100")
    @Excel(name = "订单单位数量")
    @NotNull(message = "订单单位数量不能为空")
    private Double orderQty;

    /**
     * 备注
     */
    @ExcelComment(example = "货到付款")
    @Excel(name = "备注")
    @Length(max = 100, message = "备注长度必须介于 0 和 100 之间")
    private String remark;


    /**
     * 来源标识
     */


    private Integer rowNum;
    private String errorMsg;

    @Override
    public Integer getRowNum() {
        return rowNum;
    }

    @Override
    public void setRowNum(Integer rowNum) {
        this.rowNum = rowNum;
    }

    @Override
    public String getErrorMsg() {
        return errorMsg;
    }

    @Override
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

}
